﻿using System;
using System.IO;
using Klinkby.PipesAndFilters;

namespace StrongTypedPipesAndFilters
{
    class TextReaderFilter : IFilter<byte[], string>
    {
        public string Process(byte[] value)
        {
            string text;
            using (var ms = new MemoryStream(value))
            using (var sr = new StreamReader(ms))
                text = sr.ReadToEnd();
            Console.WriteLine(text);
            return text;
        }

        public bool CanProcess(byte[] value)
        {
            return value != null;
        }
        public void Dispose()
        { }

    }
}
